﻿using Microsoft.EntityFrameworkCore;
using Admin_jiaju.Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace Admin_jiaju.EFCore
{
    public static class ModelBuilderExtensions
    {
        public static void Seed(this ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<StuClass>().HasData(
                new StuClass
                {
                    Id = 1,
                   ClassName=".net1班"
                }, new StuClass
                {
                    Id = 2,
                    ClassName = ".net2班"
                }, new StuClass
                {
                    Id = 3,
                    ClassName = ".net3班"
                }, new StuClass
                {
                    Id = 4,
                    ClassName = ".net4班"
                }
                );
            modelBuilder.Entity<Student>().HasData(
                new Student
                {
                    Id = 1,
                    StudentName = "小马",
                    Gender = true,
                    Phone = "12345678911",
                    Address = "河南驻马店",
                    StuClassId=1
                },
            new Student
            {
                Id = 2,
                StudentName = "小张",
                Gender = true,
                Phone = "12345678061",
                Address = "河南许昌",
                 StuClassId = 2
            },
             new Student
             {
                 Id = 3,
                 StudentName = "小刘",
                 Gender = true,
                 Phone = "12345678012",
                 Address = "河南驻马店",
                  StuClassId = 4
             }, new Student
             {
                 Id = 4,
                 StudentName = "小李",
                 Gender = true,
                 Phone = "12345679212",
                 Address = "河南驻马店",
                 StuClassId = 3
             }
           );
            
        }
    }
}
